package com.ly.user_system.utils;

import io.github.linpeilie.Converter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author HASEE
 */
@Component
public class ConvertUtil {

    private static Converter converter;

    @Autowired
    public void setConverter(Converter converter) {
        ConvertUtil.converter = converter;
    }

    public static <T,R> List<R> convert(List<T>dataList, Class<R> tageClass){
        return converter.convert(dataList, tageClass);
    }

    public static <T,R> R convert(T data,Class<R> tageClass){
        return converter.convert(data, tageClass);
    }

}
